package com.example.mapper.service;

import com.example.mapper.domain.Menu;
import com.example.mapper.mapper.MenuMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MenuService {

    @Autowired
    private MenuMapper menuMapper;
    public Integer add(Menu menu){
        return menuMapper.insert(menu);
    }

    public Integer delete(Integer id){
        return menuMapper.deleteByPrimaryKey(id);
    }

    public Integer update(Menu menu){
        return menuMapper.updateByPrimaryKeySelective(menu);
    }

    public Menu getById(Integer id){ return menuMapper.selectByPrimaryKey(id); }

    public List<Menu> getAll(){
        return menuMapper.selectAll();
    }
}
